var chart_pie1 = echarts.init(document.getElementById('chart_pie1'));//设备状态
var chart_pie2 = echarts.init(document.getElementById('chart_pie2'));//维保状态
var chart_bar1 = echarts.init(document.getElementById('chart_bar1'));//今日用电量
var chart_radar = echarts.init(document.getElementById('chart_radar'));//用电分析
var chart_bar2 = echarts.init(document.getElementById('chart_bar2'));//生产时长
var chart_pie3 = echarts.init(document.getElementById('chart_pie3'));//用电量分布
var chart_bar3 = echarts.init(document.getElementById('chart_bar3'));//当月告警信息
var chart_pie4 = echarts.init(document.getElementById('chart_pie4'));//用电量更多-电量结构
var chart_pie5 = echarts.init(document.getElementById('chart_pie5'));//用电量更多-电费结构
var chart_bar4 = echarts.init(document.getElementById('chart_bar4'));//用电量更多-用电量
laydate.render({
    elem: '#searchTimeBegin_time',
    range: '~'
});
//今日用电量-更多-月视图-年份选择器
laydate.render({
    elem: '#elec_month_timepicker',
    type: 'year',
    max: 0,
    done: function (value) {
        loadMoreElecMonth(value);
    }
});
//今日用电量-更多-日视图-月份选择器
laydate.render({
    elem: '#elec_day_timepicker',
    type: 'month',
    max: 0,
    done: function (value) {
        if (value) {
            loadMoreElectricity(value);
        }
    }
});
var date_eg = laydate.render({
    elem: '#duration_timepicker',
    range: '~',
    change: function (value, date, endDate) {
        if (!isNull(value)) {
            var strings = value.split(" ~ ");
            if (oneWeekLimit(strings[0], strings[1])) {
                date_eg.hint("请将时间范围控制在7天内");
            }
        }
    }
});
$('#jdl_page').paging_simple({//稼动率弹窗中的分页初始化
    pageNo: 1,
    totalPage: 10,
    totalSize: 30,
    callback: function (num) {

    }
})

$(function () {
    showLoading(LOADING);
    initChart();
    $('#year_id').text(getWeek().year());
    $('#week_id').text(getWeek().week());
    //switchWeek();
    loadDeviceType($('#deviceType'));
    /* 每5分钟执行一次*/
    setInterval(function () {
        /*获取设备数量与各个设备状态数量*/
        getDeviceTotal();
        /*当日生产时长*/
        loadProductionTime();
        /*今日用电*/
        loadToDayPower();
        /*设备使用率*/
        loadUsageRate();
        /*实时数据*/
        loadEnterpriseExtraData();
        /*获取原始数据计算用电统计下四项数据展示*/
        loadRawData();
        /*获取用电统计所需数据*/
        loadElectricityStatistics();
        /*获取当月告警信息*/
        loadAlarmInfoOfTheMonth();
        /*根据设备类型分组 查询用能*/
        loadToDayUseEnergy();
        switchWeek();
    }, 300000);
    /*关闭定时刷新*/
    // window.clearInterval(ref);
    /*加载企业信息*/
    // loadEnterprise();

    /*根据设备类型分组 查询用能*/
    loadToDayUseEnergy();
    /*获取设备数量与各个设备状态数量*/
    getDeviceTotal();
    /*加载维保*/
    loadMaintenanceList();
    /*当日生产时长*/
    loadProductionTime();
    /*今日用电*/
    loadToDayPower();
    /*设备使用率*/
    loadUsageRate();
    /*实时数据*/
    loadEnterpriseExtraData();
    /*获取原始数据计算用电统计下四项数据展示*/
    loadRawData();
    /*获取更多生产时长*/
    loadMoreProductionTime();
    /*获取用电统计所需数据*/
    loadElectricityStatistics();
    /*获取当月告警信息*/
    loadAlarmInfoOfTheMonth();
    /* 用电量更多-日视图 */
    loadMoreElectricity();
    /* 用电量更多-月视图 */
    var dateY = new Date();
    loadMoreElecMonth(dateY.getFullYear());
    switchWeek();
});

function initChart() {
    chart_pie1.setOption(option_pie1);
    chart_pie2.setOption(option_pie2);
    chart_bar1.setOption(option_bar1);
    chart_radar.setOption(option_radar);
    chart_bar2.setOption(option_bar2);
    chart_pie3.setOption(option_pie3);
    chart_bar3.setOption(option_bar3);
    chart_pie4.setOption(option_pie4);
    chart_pie5.setOption(option_pie4);
    chart_bar4.setOption(option_bar1);
}

/*获取当月告警信息*/
function loadAlarmInfoOfTheMonth() {
    getJson("/alarm/getToMonthAlarmData", null, 'GET', function (result) {
        if (result['code'] == 200) {
            var data = result['payload']['data'];
            if (data.length == 0) {
                chartNoDataHint($('#chart_bar3'));
                return;
            }
            var xArr = new Array();
            /*以恢复*/
            var restored = new Array();
            /*未恢复*/
            var notRecovered = new Array();
            /*未处理*/
            var untreated = new Array();
            /*总数*/
            var count = new Array();
            data.map(function (item) {
                xArr.push(item['dataTime']);
                restored.push(item['restored']);
                notRecovered.push(item['notRecovered']);
                untreated.push(item['untreated']);
                count.push(item['restored'] + item['notRecovered'] + item['untreated']);
            });
            chart_bar3.setOption({ //当月告警信息
                xAxis: {
                    data: xArr
                },
                series: [{
                    data: count//总数量需计算
                }, {
                    data: restored,
                }, {
                    data: notRecovered,
                }, {
                    data: untreated,
                }]
            });
        }
    })
}

/*获取设备数量与各个设备状态数量*/
function getDeviceTotal() {
    getJson("/deviceData/getDeviceTotalByCompany", null, 'GET', function (result) {
        if (result.status == 200) {
            var total1 = 0;
            var total2 = 0;
            var total3 = 0;
            var total4 = 0;
            for (var i = 0; i < result.data.length; i++) {
                var data = result.data[i];
                if (data.name == 1) {
                    total1 = data.value;
                } else if (data.name == 2) {
                    total2 = data.value;
                } else if (data.name == 3) {
                    total3 = data.value;
                } else if (data.name == 4) {
                    total4 = data.value;
                }
            }
            var dataArray = [{value: total1, name: '运行中'}, {value: total2, name: '空闲'}, {
                value: total3,
                name: '离线'
            }, {value: total4, name: '报警'}]

            var option_pie1 = {//设备状态
                title: {
                    text: result.data[4].value,//这里设置设备总数量
                },
                series: [{
                    data: dataArray
                }]
            };
            chart_pie1.setOption(option_pie1);
        } else {
            myAlert("提示", result['message'])
        }
    });
}

/*获取原始数据计算用电统计下四项数据展示*/
function loadRawData() {
    getJson('/deviceData/getEnterpriseDeviceOriginData', null, 'GET', function (data) {
        var sumPowerActive = Number(0);
        var sumPowerReacitive = Number(0);
        data.map(function (item) {
            if (data[0]['createTime'] == item['createTime']) {
                sumPowerActive += Number(item.总有功功率);
                sumPowerReacitive += Number(item.总无功功率);
            }
        });
        /*var avgPowerActive = Number(sumPowerActive / data.length);
        var avgPowerReacitive = Number(sumPowerReacitive / data.length);*/
        $('#ssyg_id').html(Math.round(Number(sumPowerActive / data.length) * 100) / 100);
        $('#sswg_id').html(Math.round(Number(sumPowerReacitive / data.length) * 100) / 100);
    });
}




/*获取设备所有实时数据*/
function loadEnterpriseExtraData() {
    getJson('/deviceData/getEnterpriseExtraData', null, 'GET', function (data) {
        var sumVoltageDeviation = Number(0);
        var sumFrequencyDeviation = Number(0);
        var sumUnblance = Number(0);
        var sumLoadRate = Number(0);
        var sumPowerFactor = Number(0);
        var health = Number(0);
        data.map(function (item) {
            sumVoltageDeviation += Number(item['voltageDeviation']);
            sumFrequencyDeviation += Number(item['frequencyDeviation']);
            sumUnblance += Number(item['unblance']);
            sumLoadRate += Number(item['loadRate']);
            sumPowerFactor += Number(item['powerFactor']);
            health += Number(item['health']);
        });
        var avgVoltageDeviation = Number(sumVoltageDeviation / data.length);
        var avgFrequencyDeviation = Number(sumFrequencyDeviation / data.length);
        var avgUnblance = Number(sumUnblance / data.length);
        var avgLoadRate = Number(sumLoadRate / data.length);
        var avgPowerFactor = Number(sumPowerFactor / data.length);
        var avghealth = Number(health / data.length);
        chart_radar.setOption({//用电分析
            series: [{
                data: [{
                    value: [Math.round(avgVoltageDeviation * 10) / 10, Math.round(avgFrequencyDeviation * 10) / 10, Math.round(avgUnblance * 10) / 10, Math.round(avgLoadRate * 10) / 10, Math.round(avgPowerFactor * 10) / 10]
                }]
            }]
        });
        $('#glys_id').text(isNaN(Math.round(avgPowerFactor * 100) / 100) ? 0 : Math.round(avgPowerFactor * 100) / 100);
        $('#fzl_id').text(isNaN(Math.round(avgLoadRate * 100) / 100) ? 0 : Math.round(avgLoadRate * 100) / 100 + '%');
        $('#jkzs_id').html(Number(avghealth.toFixed(1)));
    });
}

/*设备使用率 and 稼动率*/
var usageListTotal = 0;//总条数
var usageCurPage = 1;//当前显示的页码
function loadUsageRate() {
    $('#usageRate_List').empty();
    getJson('/deviceData/getUsageRate', null, 'GET', function (data) {
        var sum = Number(0);
        usageListTotal = 0;
        usageCurPage = 1;
        data.map(function (item) {
            usageListTotal++;
            var value = Math.round((item['value'] / 7 * 100)) / 100;
            sum += value;
            var divs = ' <div class="col-6" id="div_' + usageListTotal + '">' +
                '<div class="mb-1">' + item['date'] + '</div>' +
                '<div class="d-flex align-items-center justify-content-between">';
            if (value < 20) {
                divs += '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon "></span>' +
                    '<span class="usage-icon "></span>' +
                    '<span class="usage-icon "></span>' +
                    '<span class="usage-icon"></span>' +
                    '<span>' + value + '%</span>' +
                    '</div>' +
                    '</div>';
            } else if (value >= 20 & value < 40) {
                divs += '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon "></span>' +
                    '<span class="usage-icon "></span>' +
                    '<span class="usage-icon"></span>' +
                    '<span>' + value + '%</span>' +
                    '</div>' +
                    '</div>';
            } else if (value >= 40 & value < 60) {
                divs += '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon "></span>' +
                    '<span class="usage-icon"></span>' +
                    '<span>' + value + '%</span>' +
                    '</div>' +
                    '</div>';
            } else if (value >= 60 & value < 80) {
                divs += '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon"></span>' +
                    '<span>' + value + '%</span>' +
                    '</div>' +
                    '</div>';
            } else if (value > 80) {
                divs += '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span class="usage-icon active"></span>' +
                    '<span>' + value + '%</span>' +
                    '</div>' +
                    '</div>';
            }
            $('#usageRate_List').append(divs);
        });
        var avg = Number(sum / data.length);
        $('#syl_id').html(Math.round(avg * 100) / 100 + "%");
        $('#syl_wid_id').width(avg + "%");
        set_usage_tr(1);
    });
    /*稼动率*/
    getJson('/deviceData/getUsageRateTwo', null, 'GET', function (result) {
        var data = result['payload']['data'];
        var divs = '';
        var model = '<div class="d-flex ranking num[operation_num]">\n' +
            '      <i class="iconfont icon-paihang[operation_num]"></i>\n' +
            '      <div class="flex-1">\n' +
            '            <div class="font-p12 d-flex justify-content-between">\n' +
            '                  <div>[device_name]</div>\n' +
            '                  <div>[device_percent]%</div>\n' +
            '            </div>\n' +
            '            <div class="progress" style="height: 6px;">\n' +
            '                  <div class="progress-bar" style="width: [device_percent]%"></div>\n' +
            '            </div>\n' +
            '      </div>\n' +
            '</div>';
        for (var i = 0; i < 10; i++) {
            if (data[i]) {
                var models = model
                    .replace('[operation_num]', i + 1)
                    .replace('[operation_num]', i + 1)
                    .replace('[device_name]', data[i].date)
                    .replace('[device_percent]', Math.round(data[i].twoValue * 100) / 100)
                    .replace('[device_percent]', Math.round(data[i].twoValue * 100) / 100);
                divs += models;
            } else {
                var models = model
                    .replace('[operation_num]', i + 1)
                    .replace('[operation_num]', i + 1)
                    .replace('[device_name]', '')
                    .replace('[device_percent]', '0')
                    .replace('[device_percent]', '0');
                divs += models;
            }
        }
        $('#utilization_List').empty();
        $('#utilization_List').append($(divs));
    });
}

/* 点击稼动率-更多 */
function viewMoreJDL() {
    $('#searchTimeBegin_time').val('');
    $('#deviceName').val('');
    $('#deviceType').empty();
    loadDeviceType($('#deviceType'));
    loadMoreTimeUtilization();
    $('#JDLModal').modal();
}
/*获取今日用电量*/
function loadToDayPower() {
    getJson('/deviceData/getToDayPower', null, 'GET', function (data) {
        if (data.length == 0) {
            chartNoDataHint($('#chart_bar1'));
            return;
        }
        var xArr = new Array();
        var yArr = new Array();
        data.map(function (item) {
            xArr.push(item['date'].substring(11, 16));
            yArr.push(Math.round(item['str'] * 100) / 100);
        });
        chart_bar1.setOption({//今日用电量
            xAxis: {
                data: xArr
            },
            series: [{
                data: yArr
            }]
        });
    });
}

/*今日用能按照设备类型分组*/
function loadToDayUseEnergy() {
    getJson("/deviceData/getTheEnergyYouUseToday", null, 'GET', function (data) {
        var list = new Array();
        var jrzyn = Number(0);
        // var selected = {};
        data.map(function (item, index) {
            var innerData = {};
            jrzyn += item['value'];
            innerData.value = Math.round(item['value'] * 100) / 100;
            innerData.name = item['date'];
            list.push(innerData);
            // selected[item['date']] = index < 6;
        });

        $('#jrzyn').text(Math.round(jrzyn * 100) / 100);
        //用电量分布
        chart_pie3.setOption({
            // legend: {
            //     selected
            // },
            series: [{
                data: list
            }]
        });
    })
}

/*加载当日生产时长*/
function loadProductionTime() {
    getJson('/deviceData/getToDayProductionTime', null, 'GET', function (data) {
        $('#todayTime').html(Math.round(data * 100) / 100 + 'h');
    })
}

function switchWeek() {
    var dateTime = $('#duration_timepicker').val();
    if (!isNull(dateTime)) {
        var strings = dateTime.split(" ~ ");
        if (oneWeekhLimit(strings[0], strings[1])) {
            showModalHint("fail", "请将时间范围控制在7天内");
            return;
        }
    }
    chartNoDataHintHide($('#chart_bar2'));
    showLoading(LOADING);
    getJson('/deviceData/getProductionTimeHistogram', {time: dateTime}, 'GET', function (result) {
        var xArr = new Array();
        var yArr = new Array();
        result.map(function (item) {
            xArr.push(item['date'].substr(5, 5));
            yArr.push(Math.round(item['value'] * 100) / 100);
        });
        if (result.length == 0) {
            chartNoDataHint($('#chart_bar2'));
        }
        chart_bar2.setOption({ //生产时长
            xAxis: {
                data: xArr,
            },
            series: [{
                data: yArr,
            }]
        });
        hideLoading();
    })
}


/*获取更多生产时长*/
function loadMoreProductionTime() {
    getJson('/deviceData/getMoreProductionTime', null, 'GET', function (data) {
        $('#thisWeekTime').html(Math.round(data['week'] * 100) / 100 + 'h');
        $('#thisMonthTime').html(Math.round(data['month'] * 100) / 100 + 'h');
        if (Number(data['lestWeek']) == 0) {
            $('#hbsz_id').html("暂无同比");
        } else {
            var ratioLestWeek = (Number(data['week']) - Number(data['lestWeek'])) / Number(data['lestWeek']);
            $('#hbsz_id').html((ratioLestWeek < 0 ? "" : "+") + Math.round(ratioLestWeek * 10000) / 100 + '%');
            if (Number(data['week']) - Number(data['lestWeek']) < 0) {
                $('#hbsz_id').addClass('text-fault').removeClass('text-red');
            } else {
                $('#hbsz_id').addClass('text-red').removeClass('text-fault');
            }
        }
        if (Number(data['lestMonth']) == 0) {
            $('#hbsy_id').html("暂无环比");
        } else {
            var ratioLestMonth = (Number(data['month']) - Number(data['lestMonth'])) / Number(data['lestMonth']);
            $('#hbsy_id').html((ratioLestMonth < 0 ? "" : "+") + Math.round(ratioLestMonth * 10000) / 100 + '%');
            if (Number(data['month']) - Number(data['lestMonth']) < 0) {
                $('#hbsy_id').addClass('text-fault').removeClass('text-red');
            } else {
                $('#hbsy_id').addClass('text-red').removeClass('text-fault');
            }
        }
    })
}

/*时间稼动率更多*/
function loadMoreTimeUtilization(_pageIndex) {
    var pageIndex = parseInt(_pageIndex ? _pageIndex : '1');
    showLoading(LOADING);
    getJson('/deviceData/getUsageRateTwo', {
        dateTime: $('#searchTimeBegin_time').val(),
        deviceName: $('#deviceName').val(),
        deviceType: $('#deviceType').val(),
        pageIndex: pageIndex,
        pageSize: 10
    }, 'GET', function (result) {
        var data = result['payload']['data'];
        var payload = result['payload'];
        var divs = '';
        var model = '   <div class="bg-paragragh d-flex font-p14 ranking num[operation_num] align-items-center">\n' +
            '              <span class="text-bolder number text-center">[operation_num]</span>\n' +
            '              <div class="flex-1">\n' +
            '                <div class="d-flex justify-content-between">\n' +
            '                  <div>[device_name]</div>\n' +
            '                  <div class="text-bolder">[device_percent]%</div>\n' +
            '                </div>\n' +
            '                <div class="progress" style="height: 6px;">\n' +
            '                  <div class="progress-bar" style="width: [device_percent]%"></div>\n' +
            '                </div>\n' +
            '              </div>\n' +
            '            </div>';
        var order = 0 + 10 * (pageIndex - 1);
        data.map(function (item) {
            order++;
            var models = model
                .replace('[operation_num]', order)
                .replace('[operation_num]', order)
                .replace('[device_name]', item['date'])
                .replace('[device_percent]', Math.round(item['twoValue'] * 100) / 100)
                .replace('[device_percent]', Math.round(item['twoValue'] * 100) / 100);
            divs += models;
        });
        $('#moreTimeUtilizationList').empty();
        $('#moreTimeUtilizationList').append($(divs));
        setPaging_simple($('#jdl_page'), pageIndex, payload['pages'], payload['total'], function (num) {
            $.cookie("prdEquMaintenanceCookieNum", num, {path: '/'});
            loadMoreTimeUtilization(num);
        });
        hideLoading();
    })
}

/*加载维保状态*/

/*function loadMaintenanceList() {
    showLoading(LOADING);
    /!*getJson('/maintenance/list', null, 'GET', function (data) {
        var group1 = [];
        var group2 = [];
        var group3 = [];
        var group4 = [];
        /!*当前时间*!/
        var today = new Date();
        var list = data['payload']['data'];
        list.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /!*上次维保时间*!/
            var lastMaintenance = parseInt(item['lastMaintenance']);
            /!*维保周期转换为时间戳*!/
            var cycle = parseInt(item['cycle']);
            /!*下次维保时间*!/
            item['nextMaintenance'] = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            /!*距离上次维保时间多少天*!/
            /!*距离下次维保是多少天*!/
            var lastDay = (item['nextMaintenance'] - today.getTime()) / 1000 / 60 / 60 / 24;
            if (lastDay <= 5 && lastDay >= 0) {
                group1.push(item);
            }
            // if (nextMaintenance.getMonth() == today.getMonth()) {
            //     group1.push(item);
            // }
            if (lastDay <= (cycle / 2) && lastDay > 5) {
                group2.push(item);
            }
            if (lastDay > (cycle / 2)) {
                group3.push(item);
            }
            if (lastDay < 0) {
                group4.push(item);
            }
        });
        var count = [
            {name: '应维保', value: group1.length},
            {name: '待维保', value: group2.length},
            {name: '已延期', value: group4.length},
            {name: '已完成', value: group3.length}
        ];
        chart_pie2.setOption({//维保状态
            series: [{
                data: count
            }]
        });
        hideLoading();
    });*!/
    getJson('/maintenance/list', null, 'GET', function (data) {
        var group1 = [];
        var group2 = [];
        var group3 = [];
        var group4 = [];
        var group5 = [];
        var month = getDate(new Date()).month();
        var date = getDate(new Date()).date();
        var year = getDate(new Date()).year();
        var list = data['payload']['data'];
        var extension = data['payload']['extension'];
        list.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /!*上次维保时间*!/
            var lastMaintenance = parseInt(item['lastMaintenance']);
            /!*维保周期转换为时间戳*!/
            var cycle = parseInt(item['cycle']);
            /!*下次维保时间*!/
            item['nextMaintenance'] = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            var nextMaintenance = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            /!*已维保*!/
            if (getDate(lastMaintenance).year() == year && getDate(lastMaintenance).month() == month) {
                group1.push(item);
            } else if (getDate(nextMaintenance).year() == year && getDate(nextMaintenance).month() == month) {
                /!*应维保*!/
                if (getDate(nextMaintenance).date() == date) {
                    group2.push(item);
                } else   /!*待维保*!/
                if (contrastTime(getDate(nextMaintenance).date(), date)) {
                    group3.push(item);
                }
            }
            /!*已延期*!/
            if (contrastTime(date, getDate(nextMaintenance).date())) {
                group4.push(item);
            }


        });
        extension.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /!*维保周期转换为时间戳*!/
            var cycle = parseInt(item['cycle']);
            var lastMaintenance = parseInt(item['lastMaintenance']);
            item['nextMaintenance'] = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            group5.push(item);
        });
        chart_pie2.setOption({
            title: {
                text: group1.length + group2.length + group3.length + group4.length,//这里设置应维保数
            },
            series: [{
                data: [
                    {name: '应维保', value: group2.length},
                    {name: '已维保', value: group1.length},
                    {name: '待维保', value: group3.length},
                    {name: '已延期', value: group4.length},
                    {name: '延期保养', value: group5.length}
                ]
            }]
        });
        hideLoading();
    });
}*/
function loadMaintenanceList() {
    showLoading(LOADING);
    getJson('/maintenance/list', null, 'GET', function (data) {
        var group1 = [];
        var group2 = [];
        var group3 = [];
        var group4 = [];
        var group5 = [];
        var month = getDate(new Date()).month();
        var date = getDate(new Date()).date();
        var year = getDate(new Date()).year();
        var list = data['payload']['data'];
        var extension = data['payload']['extension'];
        list.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /*本次维保时间*/
            var toMaintenance = parseInt(item['lastMaintenance']);
            /*维保周期转换为时间戳*/
            var cycle = parseInt(item['cycle']);
            /*应维保时间 本次维保时间加周期*/
            item['maintenanceDate'] = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            item['nextMaintenance'] = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            /*应维保时间  本次维保时间加周期*/
            var maintenanceDate = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            if (getDate(maintenanceDate).year() === year && getDate(maintenanceDate).month() === month) {
                /*应维保*/
                if (getDate(maintenanceDate).date() === date) {
                    group2.push(item);
                } else   /*待维保*/
                if (contrastTime(getDate(maintenanceDate).date(), date)) {
                    group3.push(item);
                }
            }
            /*已延期*/
            if (contrastTime(date, getDate(maintenanceDate).date())) {
                group4.push(item);
            }
            /*已维保*/
            if (getDate(toMaintenance).year() === year && getDate(toMaintenance).month() === month) {
                if (!item['previousMaintenance']) {
                    item['previousMaintenance'] = item['createTime'];
                }
                /*上次维保时间*/
                var previousMaintenance = parseInt(item['previousMaintenance']);
                /*应维保日期*/
                item['maintenanceDate'] = previousMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
                if (getDate(item['maintenanceDate']).year() === year && getDate(item['maintenanceDate']).month() === month) {
                    group1.push(item);
                }
                item['nextMaintenance'] = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            }
        });
        extension.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /*维保周期转换为时间戳*/
            var cycle = parseInt(item['cycle']);
            var lastMaintenance = parseInt(item['lastMaintenance']);
            item['maintenanceDate'] = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            item['nextMaintenance'] =  item['maintenanceDate'] + parseInt(cycle * 24 * 60 * 60 * 1000);
            group5.push(item);
        });
        chart_pie2.setOption({
            title: {
                text: group1.length + group2.length + group3.length + group4.length,//这里设置应维保数
            },
            series: [{
                data: [
                    {name: '应维保', value: group2.length},
                    {name: '已维保', value: group1.length},
                    {name: '待维保', value: group3.length},
                    {name: '已延期', value: group4.length},
                    {name: '延期保养', value: group5.length}
                ]
            }]
        });
        hideLoading();
    });
}





function logout() {
    getJson('/sys/logout', null, 'GET', function (data) {
        myAlert('提示', data['message'], function () {
            top.location.href = host + '/index.html';
        });
    })
}


/*获取用电统计下图表所需数据*/
function loadElectricityStatistics() {
    var time = new Date().getHours();
    /*获取当前企业下所有设备,*/
    getJson('/deviceData/getDeviceByEId', null, 'GET', function (data) {
        var currentPrice = Number(0);
        for (var i = 0; i < data.length; i++) {
            if (judgeThePeakValleyFlat(time) == 'max') {
                currentPrice += data[i].maxPrice;
            } else if (judgeThePeakValleyFlat(time) == 'min') {
                currentPrice += data[i].minPrice;
            } else {
                currentPrice += data[i].avgPrice;
            }
        }
        var yesterdayPrice = Number(0);
        var lastMonthPrice = Number(0);
        var currentPrice2 = Number(currentPrice / data.length);
        /*获取计算所需数据*/
        getJson('/deviceData/getElectricityStatistics', null, 'GET', function (data) {
            $('#today').html(Math.round(data.toDayData) / 10000);
            $('#month').html(Math.round(data.thisMonthData) / 10000);
            $('#yesterday').html(Math.round(data.yesterdayData) / 10000);
            yesterdayPrice = Number(data.yesterdayData) / Number(data.yesterday);
            lastMonthPrice = Number(data.lastMonthData) / Number(data.lastMonth);
            $('#currentPrice').html(Math.round(currentPrice2 * 10000) / 10000);
            $('#yesterdayPrice').html(Math.round(yesterdayPrice * 10000) / 10000);
            $('#lastMonthPrice').html(Math.round(lastMonthPrice * 10000) / 10000);
            hideLoading();
        })

    })
}

// 设置设备使用率显示的行，10条每页。传参：e--展示第e页
function set_usage_tr(pageSize) {
    var start = (pageSize - 1) * 10 + 1;
    var end = pageSize * 10;
    $('.col-6').addClass('d-none');
    for (var i = start; i <= end; i++) { // tr_len是要控制的tr个数
        $("#div_" + i).removeClass('d-none');
    }
    if (pageSize == 1) {//第一页，禁用向左按钮（样式、事件）
        $('#page_arrow_left').addClass('disabled');
        $('#page_arrow_left').off('click');
    } else {
        $('#page_arrow_left').removeClass('disabled');
        $('#page_arrow_left').off('click');
        $('#page_arrow_left').click(function () {
            usageCurPage -= 1;
            set_usage_tr(usageCurPage);
        });
    }
    if (Math.ceil(usageListTotal / 10) == pageSize) {//最后一页，禁用向右按钮
        $('#page_arrow_right').addClass('disabled');
        $('#page_arrow_right').off('click');
    } else {
        $('#page_arrow_right').removeClass('disabled');
        $('#page_arrow_right').off('click');
        $('#page_arrow_right').click(function () {
            usageCurPage += 1;
            set_usage_tr(usageCurPage);
        });
    }
}

function loadMoreElectricity(dateStr) {
    showLoading(LOADING);
    var date;
    if (dateStr) {
        date = new Date(dateStr.split('-'));
    } else {
        date = new Date();
    }
    var year = date.getFullYear();
    var month = date.getMonth();//实际月份
    var firstDate = new Date(year, month, '1');//1号，date对象
    var lastDate = new Date(year, month + 1, 0);
    firstDate.setDate(firstDate.getDate() - firstDate.getDay());//所求起始日，date对象
    lastDate.setDate(lastDate.getDate() + (6 - lastDate.getDay()));
    $('#elec_day_table tbody').empty();
    getJson("/deviceData/getMorePowerConsumption", {
        startTime: getFormatTime(firstDate).formatDate,
        endTime: getFormatTime(lastDate).formatDate
    }, 'GET', function (data) {
        var td = '';
        for (var i = 0; i < data.length; i++) {
            if (i % 7 == 0) {
                td += '<tr>';
            }
            td += '<td data-date="' + data[i].date + '">\n' +
                '<div class="title">' + data[i].date.substr(8, 2) + '</div>\n' +
                '<div class="value">' + data[i].value + '</div>\n' +
                '</td>';
            if (i % 7 == 6) {
                td += '</tr>';
            }
        }
        $('#elec_day_table tbody').append($(td));
        hideLoading();
    })
}

function loadMoreElecMonth(year) {
    showLoading(LOADING);
    $('#elec_month_table tbody').empty();
    getJson("/deviceData/getMorePowerConsumptionYear", {
        year: year
    }, 'GET', function (data) {
        var td = '';
        for (var i = 0; i < data.length; i++) {
            if (i % 4 == 0) {
                td += '<tr>';
            }
            td += '<td>\n' +
                '<div class="title">' + data[i].date.substr(5, 2) + '月</div>\n' +
                '<div class="value">' + data[i].value + '</div>\n' +
                '</td>';
            if (i % 4 == 3) {
                td += '</tr>';
            }
        }
        $('#elec_month_table tbody').append($(td));
        hideLoading();
    })
}

/*点击日视图中的某一日，加载其日数据*/
$('#elec_day_table').delegate('td', 'click', function () {
    showLoading(LOADING);
    $('#MoreElecViewModal').modal('hide');
    $('#MoreElecDetailModal').modal();
    var date = $(this).attr('data-date');
    $('#elecDetailDate').text(date);
    getJson("/deviceData/getMorePowerConsumptionDay", {
        day: date
    }, 'GET', function (data) {
        var pie4_valueList = [
            {value: Math.round(data.maxPower) / 10000, name: '峰值'},
            {value: Math.round(data.avgPower) / 10000, name: '平值'},
            {value: Math.round(data.minPower) / 10000, name: '谷值'}
        ];
        var pie4_sum = Math.round(Math.round(data.maxPower) + Math.round(data.avgPower) + Math.round(data.minPower)) / 10000;
        $('#elec_more_power').text(pie4_sum);
        chart_pie4.setOption({
            legend: {
                formatter: function (name) {
                    var index = 0;
                    pie4_valueList.forEach(function (value, i) {
                        if (value.name == name) {
                            index = i;
                        }
                    });
                    var percent = 0;
                    if (pie4_sum != 0) {
                        percent = Math.round(pie4_valueList[index].value / pie4_sum * 10000) / 100;
                    }
                    return name + "：" + percent + '%';
                }
            },
            series: [{
                data: pie4_valueList
            }]
        });
        var pie5_valueList = [
            {value: Math.round(data.maxBill) / 10000, name: '峰值'},
            {value: Math.round(data.avgBill) / 10000, name: '平值'},
            {value: Math.round(data.minBill) / 10000, name: '谷值'}
        ];
        var pie5_sum = Math.round(Math.round(data.maxBill) + Math.round(data.avgBill) + Math.round(data.minBill)) / 10000;
        $('#elec_more_bill').text(pie5_sum);
        var price = 0;
        if (pie4_sum != 0) {
            price = Math.round(pie5_sum / pie4_sum * 10000) / 10000;
        }
        $('#elec_more_price').text(price);
        chart_pie5.setOption({
            legend: {
                formatter: function (name) {
                    var index = 0;
                    pie5_valueList.forEach(function (value, i) {
                        if (value.name == name) {
                            index = i;
                        }
                    });
                    var percent = 0;
                    if (pie5_sum != 0) {
                        percent = Math.round(pie5_valueList[index].value / pie5_sum * 10000) / 100;
                    }
                    return name + "：" + percent + '%';
                }
            },
            series: [{
                data: pie5_valueList
            }]
        });
        hideLoading();
    });
    chartNoDataHintHide($('#chart_bar4'));
    chart_bar4.setOption({//今日用电量
        xAxis: {
            data: []
        },
        series: [{
            data: []
        }]
    });
    chart_bar4.showLoading({
        textColor: '#fff',
        maskColor: 'rgba(0, 0, 0, 0.8)',
    });
    getJson("/deviceData/getEnergyUsedByDay", {
        day: date
    }, 'GET', function (data) {
        hideLoading();
        chart_bar4.hideLoading();
        if (data.length == 0) {
            chartNoDataHint($('#chart_bar4'));
            return;
        }
        var xArr = [];
        var yArr = [];
        data.map(function (item) {
            xArr.push(item.date.substr(0, 5));
            yArr.push(Math.round(item.work * 100) / 100);
        });
        chart_bar4.setOption({//今日用电量
            xAxis: {
                data: xArr
            },
            series: [{
                data: yArr
            }]
        });
    });
});

$('#MoreElecDetailModal').on('shown.bs.modal', function (e) {
    chart_pie4.resize();
    chart_pie5.resize();
    chart_bar4.resize();
    chartNoDataHintResize($('#chart_bar4'));
})

function backToElecView() {
    $('#MoreElecViewModal').modal();
    $('#MoreElecDetailModal').modal('hide');
}

/*切换用电量-更多日视图、月视图块展示*/
function switchMoreElecSec(e, index) {
    $(e).addClass('active').parent().siblings('.nav-item').children().removeClass('active');
    $('.more-elec-sec').hide(0);
    $('#more_elec_sec' + index).show(0);
}

var option_pie1 = {//设备状态
    title: {
        text: '0',//这里设置设备总数量
        left: 'center',
        top: '93',
        textStyle: {
            color: '#FAD488',
            fontSize: 24,
            fontFamily: 'DIN-Bold'
        },
        subtext: '设备总数',
        subtextStyle: {
            color: '#fff',
            fontSize: 12,
            fontWeight: 400,
        },
        itemGap: 5
    },
    color: ['#00E3D2', '#0096FF', '#D1D1D1', '#FF7931'],
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)',
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    series: [{
        name: '设备数量',
        type: 'pie',
        radius: [35, 60],
        center: ['50%', '50%'],
        label: {
            formatter: '{b}:{c}',
            fontSize: 14
        },
        labelLine: {
            length: 5,
            length2: 10
        },
        data: [
            {value: 0, name: '运行中'},
            {value: 0, name: '空闲'},
            {value: 0, name: '离线'},
            {value: 0, name: '报警'}
        ]
    }]
};
var option_pie2 = {//维保状态
    color: ['#0096FF', '#5DDF91', '#F8DD83', '#F95959', '#FF7931'],
    title: {
        text: '0',//这里设置设备总数量
        left: 'center',
        top: '93',
        textStyle: {
            color: '#00E3D2',
            fontSize: 24,
            fontFamily: 'DIN-Bold'
        },
        subtext: '当月需定保',
        subtextStyle: {
            color: '#fff',
            fontSize: 12,
            fontWeight: 400,
        },
        itemGap: 5
    },
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)',
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    series: [{
        name: '设备数量',
        type: 'pie',
        radius: [42, 60],
        center: ['50%', '50%'],
        label: {
            formatter: '{b}:{c}',
            fontSize: 14
        },
        labelLine: {
            length: 10,
            length2: 0
        },
        data: [
            {value: 0, name: '应维保'},
            {value: 0, name: '已维保'},
            {value: 0, name: '待维保'},
            {value: 0, name: '已延期'},
            {value: 0, name: '延期保养'}
        ]
    }]
};
var option_bar1 = {//今日用电量
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow',
            shadowStyle: {
                color: 'rgba(59, 85, 159, 0.3)'
            }
        },
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    grid: {
        top: 30,
        left: 15,
        right: 18,
        bottom: 0,
        containLabel: true
    },
    xAxis: {
        type: 'category',
        axisLine: {
            lineStyle: {
                color: 'rgba(209, 230, 249, 0.7)'
            }
        },
        axisLabel: {
            color: 'rgba(209, 230, 249, 0.7)'
        },
        axisTick: {
            lineStyle: {
                color: 'rgba(209, 230, 249, 0.7)'
            }
        },
        splitLine: {
            show: false
        }
    },
    yAxis: {
        type: 'value',
        name: 'kWh',
        nameTextStyle: {
            color: '#fff'
        },
        axisLine: {
            show: false
        },
        axisLabel: {
            color: '#fff'
        },
        axisTick: {
            show: false
        },
        splitLine: {
            lineStyle: {
                color: ['rgba(22, 126, 226, 0.2)'],
                type: 'dashed'
            }
        }
    },
    series: [{
        name: '用电量',
        type: 'bar',
        barMaxWidth: 6,
        itemStyle: {
            normal: {
                barBorderRadius: [3, 3, 0, 0],
//不同时段柱子设置不同颜色
                color: function (params) {
                    var colorList = [{//谷 0-8
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#009AEA' // 0% 处的颜色
                        }, {
                            offset: 1, color: 'rgba(0,154,234,0)' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }, {//平 12-17，21-24
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#F2CB6B' // 0% 处的颜色
                        }, {
                            offset: 1, color: 'rgba(242,203,107,0)' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }, {//峰 8-12，17-21
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#FF8B35' // 0% 处的颜色
                        }, {
                            offset: 1, color: 'rgba(255,139,53,0)' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }];
                    if (Number(params.name.substr(0, 2)) >= 0 && Number(params.name.substr(0, 2)) < 8) {//谷
                        return colorList[0];
                    } else if ((Number(params.name.substr(0, 2)) >= 12 && Number(params.name.substr(0, 2)) < 17) || (Number(params.name.substr(11, 2)) >= 21)) {
                        return colorList[1];
                    } else {
                        return colorList[2]
                    }
                }
            }
        }
    }]
};
var option_radar = {//用电分析
    color: '#1890FF',
    tooltip: {
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    radar: {
        name: {
            textStyle: {
                color: '#fff',
                lineHeight: 14
            }
        },
        center: ['50%', '57%'],
        radius: '80%',
        indicator: [
            {name: '电压偏差', max: 100},
            {name: '频率\n偏差', max: 100},
            {name: '三相不平衡', max: 100},
            {name: '负载率', max: 100},
            {name: '功率\n因数', max: 100}
        ],
        axisLine: {
            lineStyle: {
                color: '#D1E6F9'
            }
        },
        splitLine: {
            lineStyle: {
                color: ['#707070']
            }
        },
        splitArea: {
            areaStyle: {
                color: ['rgba(250,250,250,0.1)', 'rgba(200,200,200,0.1)']
            }
        }
    },
    series: [{
        name: '用电分析',
        type: 'radar',
        showSymbol: false,
        areaStyle: {
            color: 'rgba(13, 98, 177, 0.3)'
        },
        lineStyle: {
            color: '#1890FF',
            width: 2
        },
        label: {
            //show: true,
            formatter: '{c}'
        },
        data: [{
            value: [95, 100, 88, 98, 90]
        }]
    }]
};
var option_bar2 = { //生产时长
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow',
            shadowStyle: {
                color: 'rgba(59, 85, 159, 0.3)'
            }
        },
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    grid: {
        top: 30,
        left: 0,
        right: 0,
        bottom: 0,
        containLabel: true
    },
    xAxis: {
        // data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
        type: 'category',
        axisLine: {
            lineStyle: {
                color: 'rgba(209, 230, 249, 0.7)'
            }
        },
        axisLabel: {
            color: 'rgba(209, 230, 249, 0.7)'
        },
        axisTick: {
            lineStyle: {
                color: 'rgba(209, 230, 249, 0.7)'
            }
        },
        splitLine: {
            show: false
        }
    },
    yAxis: {
        type: 'value',
        name: 'H',
        nameTextStyle: {
            color: '#fff',
            //fontFamily: 'DIN-Bold'
        },
        axisLine: {
            show: false
        },
        axisLabel: {
            color: '#fff'
        },
        axisTick: {
            show: false
        },
        splitLine: {
            lineStyle: {
                color: ['rgba(22, 126, 226, 0.2)'],
                type: 'dashed'
            }
        }
    },
    series: [{
        name: '生产时长',
        type: 'bar',
        // data: [12, 21, 13, 4, 5, 23.5],
        itemStyle: {
            color: new echarts.graphic.LinearGradient(
                0, 0, 0, 1,
                [
                    {offset: 0, color: '#00E3D2'},
                    {offset: 1, color: 'rgba(0,0,0,0)'}
                ]
            )
        },
    }]
};
var option_pie3 = {//用电量分布
    color: ['#F8DD83', '#718BF3', '#FF7931', '#5DDF91', '#0096FF'],
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)',
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    legend: {
        type: 'scroll',
        pageIconInactiveColor: '#2f4554',
        pageIconColor: '#0056d4',
        pageIconSize: 14,
        pageTextStyle: {
            color: '#aaa'
        },
        orient: 'vertical',
        left: 335,
        top: 'middle',
        icon: 'rect',
        itemHeight: 14,
        itemWidth: 14,
        textStyle: {
            color: '#83D0EF',
            fontSize: 14,
            padding: [0, 3]
        },
        formatter: function (name) {
            if (name.length > 6) {
                name = name.substr(0, 6) + '...'
            }
            return name
        }
    },
    series: [{
        name: '用电量',
        type: 'pie',
        radius: [60, 82],
        center: ['170', '50%'],
        label: {
            show: false,
            // formatter: function (params) {
            //     let name = params.name;
            //     if (name.length > 6) {
            //         name = name.substr(0, 6) + '...'
            //     }
            //     return name + '\n' + params.value + 'kWh'
            // },
            // fontSize: 12,
            // color: '#fff'
        },
        // labelLine: {
        //     length: 10,
        //     length2: 0
        // },
        data: []
    }]
};
var option_bar3 = { //当月告警信息
    color: ['rgba(59, 85, 159, 0.3)', '#0096FF', '#FAD488', '#F95959'],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow',
            shadowStyle: {
                color: 'rgba(59, 85, 159, 0.3)'
            }
        },
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    grid: {
        top: 30,
        left: 0,
        right: 8,
        bottom: 0,
        containLabel: true
    },
    xAxis: {
        // data: increaseArr(24, 1),
        type: 'category',
        axisLine: {
            lineStyle: {
                color: 'rgba(209, 230, 249, 0.7)'
            }
        },
        axisLabel: {
            color: 'rgba(209, 230, 249, 0.7)'
        },
        axisTick: {
            lineStyle: {
                color: 'rgba(209, 230, 249, 0.7)'
            }
        },
        splitLine: {
            show: false
        }
    },
    yAxis: {
        type: 'value',
        name: '次',
        nameTextStyle: {
            color: '#fff'
        },
        axisLine: {
            show: false
        },
        axisLabel: {
            color: '#fff'
        },
        axisTick: {
            show: false
        },
        splitLine: {
            lineStyle: {
                color: ['rgba(22, 126, 226, 0.2)'],
                type: 'dashed'
            }
        }
    },
    series: [{
        name: '报警数量',
        type: 'bar',
        barGap: '-100%',
        // data: randomFun(24, 0, 100, 0)//总数量需计算
    }, {
        name: '已恢复',
        type: 'bar',
        // data: randomFun(24, 0, 100, 0),
        stack: '报警数量'
    }, {
        name: '未恢复',
        type: 'bar',
        // data: randomFun(24, 0, 100, 0),
        stack: '报警数量'
    }, {
        name: '未处理',
        type: 'bar',
        // data: randomFun(24, 0, 100, 0),
        stack: '报警数量'
    }]
};

var pie1_valueList = [
    {value: 45, name: '峰值'},
    {value: 36, name: '平值'},
    {value: 28, name: '谷值'}
];
var pie1_sum = 45 + 36 + 28;
var option_pie4 = {//用电量更多-电量结构&电费结构
    color: ['#D97D34', '#D9B65C', '#0085CB'],
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)',
        backgroundColor: 'rgba(39, 71, 105, 0.7)'
    },
    legend: {
        orient: 'vertical',
        bottom: 28,
        left: 20,
        icon: 'path://M0 0m407.253608 0l814.507217 0q407.253608 0 407.253608 407.253608l0 0q0 407.253608-407.253608 407.253609l-814.507217 0q-407.253608 0-407.253608-407.253609l0 0q0-407.253608 407.253608-407.253608Z',
        itemWidth: 16,
        itemHeight: 8,
        itemGap: 12,//每个图例间距
        textStyle: {
            fontSize: 12,
            color: ['#D97D34', '#D9B65C', '#0085CB'],
            padding: [0, 10]//文字与图标间距
        },
        formatter: function (name) {
            var index = 0;
            pie1_valueList.forEach(function (value, i) {
                if (value.name == name) {
                    index = i;
                }
            });
            return name + "：" + Math.round(pie1_valueList[index].value / pie1_sum * 1000) / 10 + '%';
        }
    },
    series: [{
        name: '电量',
        type: 'pie',
        radius: [0, 80],
        center: ['70%', '50%'],
        label: {
            show: false
        },
        data: pie1_valueList
    }]
};